home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_08_1985_Transactor_Publishing.d64 / star 0.14 < prev    next >
Text File  |  2023-02-26  |  910b  |  43 lines

  1. 0010 // "STAR" - this is a sample comal
  2. 0020 // program to draw a star of any
  3. 0030 // number of points.
  4. 0040 // comal 0.14 version
  5. 0050 // * transactor magazine - cz *
  6. 0060 dim a$ of 1
  7. 0070 print chr$(147),
  8. 0080 siz:=100
  9. 0090 while true do
  10. 0100 print chr$(19),
  11. 0110 settext 
  12. 0120 input "number of points? ": points
  13. 0130 setgraphic 0
  14. 0140 clear 
  15. 0150 home 
  16. 0160 pendown 
  17. 0170 star(siz,points)
  18. 0180 input a$
  19. 0190 endwhile 
  20. 0200 end 
  21. 0210 //
  22. 0220 proc star(siz,points) closed
  23. 0230 // ** draw an n-pointed star **
  24. 0240 // first calculate the angle to
  25. 0250 // turn at each point
  26. 0260 case (points mod 4) of
  27. 0270 when 0
  28. 0280 angvar:=points
  29. 0290 when 2
  30. 0300 angvar:=points/2
  31. 0310 otherwise 
  32. 0320 angvar:=points*2
  33. 0330 endcase 
  34. 0340 angle:=180-360/angvar
  35. 0350 //
  36. 0360 // now draw the star
  37. 0370 setheading ((180-angle)/2)
  38. 0380 for i:=1 to points do
  39. 0390 forward (siz)
  40. 0400 right (angle)
  41. 0410 endfor i
  42. 0420 endproc star
  43.